<script setup lang="ts">
import { myStore } from '@/store/my';
import { RouteLocationRaw, useRouter } from 'vue-router';
const store = myStore()
const router = useRouter()
if (!store.state.userInfo.account_price) store.getUserInfo()

const gotoPage = (path: RouteLocationRaw) => {
  router.push(path)
}
</script>

<template>
   <div class="account-info">
    <p>
        <label>账户余额（无忧币）<van-icon @click="gotoPage('/my/account/coinExplain')" name="question-o" /></label>
        <span @click="gotoPage('/my/account/advance')">提现<van-icon name="arrow" /></span>
    </p>
    <!-- Number 值的 toFixed() 方法使用定点表示法来格式化该数值。 -->
    <h3>￥{{ store.state.userInfo.account_price && store.state.userInfo.account_price.toFixed(2) }}</h3>
   </div>
</template>

<style scoped>
.account-info{
    background: #FF8E00;
    width: 100%;
  }
  p{
    padding: 1rem 0.67rem 3.57rem;
    font-size: 0.8rem;
    line-height: 0.8rem;
    font-weight: 400;
    color: #FFFFFF;
    display: flex;
    justify-content: space-between;
  }
  h3{
    font-size: 1.6rem;
    line-height: 1.6rem;
    font-weight: 400;
    color: #FFFFFF;
    padding-bottom: 2.13rem;
    text-align: center;
  }
  dl{
    display: flex;
  }
  dt{
    flex:1;
    text-align: center;
  }
  h5{
    font-size: 0.8rem;
    font-weight: bold;
    color: #FFFFFF;
    line-height: 1.07rem;
  }
  h6{
    font-size: 0.69rem;
    font-weight: 400;
    color: #FFFFFF;
    line-height: 1.07rem;
    margin: 0.53rem 0 1.09rem;
  }
</style>